package com.xiaoke.service.impl;

import com.xiaoke.mapper.SearchHistoryMapper;
import com.xiaoke.service.SearchHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SearchHistoryServiceImpl implements SearchHistoryService {
    @Autowired
    private SearchHistoryMapper searchHistoryMapper;

    @Override
    @Transactional(readOnly = false)
    public void deleteByUser(String userId,String shopId) {
        searchHistoryMapper.deleteByUser(userId,shopId);
    }

    @Override
    public List<String> findTop10ByUserAndShop(String userId, String shopId) {
        return searchHistoryMapper.findTop10ByUserAndShop(userId,shopId);
    }
}
